﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CimeaSoft.BE;

namespace CimeaSoft.Repository
{
    public class AbiRepository:MasterRepository,IAbiRepository
    {
        public List<Abi> GetAllFromAbi()
        {
            var query = from c in context.Abis
                        select c;
            return query.ToList();
        }


        public List<Abi> GetAllFromAbiByCriterio(string criterio)
        {
            var query = from e in context.Abis
                        select e;
            if (criterio != null && criterio != string.Empty && criterio != "")
            {
                query = from e in context.Abis
                        where e.Familia.ToUpper().Contains(criterio) ||
                        e.Orden.ToUpper().Contains(criterio)
                        select e;
            }
            return query.ToList();
        }
    }
}
